using System;
using System.Collections.Generic;
using SouthernLand.Common.DAL.NhaDat;

namespace SouthernLand.Common.BOL.NhaDat
{
    public class QuanHuyen
    {
        #region Public Properties

        public Int32 QuanHuyenID { get; set; }

        public Int32 TinhThanhID { get; set; }

        public String TenQuanHuyen { get; set; }

        public String TenQuanHuyen_en { get; set; }

        public Int32 ViTri { get; set; }
        #endregion

        #region public static Methods

        public static string GetTenQuanHuyenByID(int ID)
        {
            try
            {
                QuanHuyen obj = GetQuanHuyenByID(ID);
                return Globals.GetLang(obj.TenQuanHuyen, obj.TenQuanHuyen_en);
            }
            catch
            {
                return "";
            }
        }

        public static int Insert(QuanHuyen obj)
        {
            var db = new QuanHuyenDAL();
            return db.Insert(obj);
        }

        public static bool Update(QuanHuyen obj)
        {
            var db = new QuanHuyenDAL();
            return db.Update(obj);
        }

        public static bool Delete(Int32 QuanHuyenID)
        {
            var db = new QuanHuyenDAL();
            return db.Delete(QuanHuyenID);
        }

        public static QuanHuyen GetQuanHuyenByID(Int32 QuanHuyenID)
        {
            var db = new QuanHuyenDAL();
            return db.GetQuanHuyenByID(QuanHuyenID);
        }


        // Get QuanHuyenByTinhThanhID
        public static List<QuanHuyen> GetQuanHuyenByTinhThanhID(Int32 TinhThanhID)
        {
            var db = new QuanHuyenDAL();
            return db.GetQuanHuyenByTinhThanhID(TinhThanhID, 1, 100);
        }

        //Get All QuanHuyen
        public static List<QuanHuyen> GetAllQuanHuyen()
        {
            var db = new QuanHuyenDAL();
            return db.GetAllQuanHuyen(1, 10000);
        }

        //Get All QuanHuyen
        public static List<QuanHuyen> GetAllQuanHuyen(int PageIndex, int PageSize)
        {
            var db = new QuanHuyenDAL();
            return db.GetAllQuanHuyen(PageIndex, PageSize);
        }

        // Get Count All records of Table  QuanHuyen
        public static int GetCountQuanHuyen()
        {
            var db = new QuanHuyenDAL();
            return db.GetCountQuanHuyen();
        }

        #endregion
    }
}